package cn.edu.usst.cs.stu_sys011;

public class Grade {
    final float weight = 0.5f;
    boolean _init = false;
    float grade_routine = 0f;
    float grade_final = 0f;

    public Grade get() {
        return this;
    }

    public void init(float grade_routine, float grade_final) {
        this.grade_routine = grade_routine;
        this.grade_final = grade_final;
        _init = true;
    }
    public void setGrade_routine(float grade_routine) {
        this.grade_routine = grade_routine;
        if(grade_final!=0)
            _init = true;
    }
    public void setGrade_final(float grade_final) {
        this.grade_final = grade_final;
        if(grade_routine!=0)
            _init = true;
    }


    public float getGrade_routine() {
        return grade_routine;
    }

    public float getGrade_final() {
        return grade_final;
    }

    public float getGrade_total() {
        return grade_routine * weight + grade_final * (1 - weight);
    }
}
